Skip to content

fix(api): cherry-pick model-type migration script to hotfix/1.14.1-fix.3 - #36704

Merged
wylswz merged 2 commits into
hotfix/1.14.1-fix.3from
fix/cherrypick-model-type-migration
May 27, 2026
Merged

wylswz merged 2 commits into
hotfix/1.14.1-fix.3from
fix/cherrypick-model-type-migration

Conversation

@GareArc

@GareArc GareArc commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Cherry-pick of #36520 onto hotfix/1.14.1-fix.3.

Introduces an online data migration CLI command to canonicalize legacy model_type values in provider-related tables:

Legacy value Canonical value
text-generation llm
embeddings text-embedding
reranking rerank

Affected tables: provider_models, tenant_default_models, provider_model_settings, load_balancing_model_configs, provider_model_credentials.

Usage:

# Dry-run (default) — emits JSONL audit log, no DB changes
flask data-migrate legacy-model-types

# Apply
flask data-migrate legacy-model-types --apply

Conflict resolution

api/pyproject.toml had a version conflict between branches. Kept hotfix/1.14.1-fix.3 pins (litellm>=1.83.7, pyarrow>=18.0.0).

Test plan

  • pytest api/tests/unit_tests/commands/test_legacy_model_type_migration.py — 31 passed

@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label May 27, 2026
@github-actions

github-actions Bot commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-05-27 03:46:49.205569318 +0000
+++ /tmp/pyrefly_pr.txt	2026-05-27 03:46:37.028447631 +0000
@@ -600,6 +600,14 @@
    --> tasks/regenerate_summary_index_task.py:277:60
 ERROR Class member `AsyncWorkflowCFSPlanScheduler.plan` overrides parent class `CFSPlanScheduler` in an inconsistent manner [bad-override-mutable-attribute]
   --> tasks/workflow_cfs_scheduler/cfs_scheduler.py:19:5
+ERROR Object of class `FromClause` has no attribute `metadata` [missing-attribute]
+  --> tests/helpers/legacy_model_type_migration.py:64:16
+ERROR Object of class `FromClause` has no attribute `metadata` [missing-attribute]
+  --> tests/helpers/legacy_model_type_migration.py:80:16
+ERROR Argument `dict[_KeyType, Any]` is not assignable to parameter `object` with type `dict[str, object]` in function `list.append` [bad-argument-type]
+   --> tests/helpers/legacy_model_type_migration.py:138:23
+ERROR Object of class `FromClause` has no attribute `insert` [missing-attribute]
+   --> tests/helpers/legacy_model_type_migration.py:182:13
 ERROR Argument `_GP` is not assignable to parameter `graph_init_params` with type `GraphInitParams` in function `core.workflow.nodes.datasource.datasource_node.DatasourceNode.__init__` [bad-argument-type]
   --> tests/integration_tests/core/workflow/nodes/datasource/test_datasource_node_integration.py:85:27
 ERROR Argument `_GS` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `core.workflow.nodes.datasource.datasource_node.DatasourceNode.__init__` [bad-argument-type]
@@ -1812,6 +1820,30 @@
   --> tests/unit_tests/commands/test_clean_expired_messages.py:94:9
 ERROR Expected a callable, got `None` [not-callable]
    --> tests/unit_tests/commands/test_clean_expired_messages.py:176:9
+ERROR Generator function should return `Generator` [bad-return]
+  --> tests/unit_tests/commands/test_legacy_model_type_migration.py:36:38
+ERROR Object of class `FromClause` has no attribute `insert` [missing-attribute]
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:204:13
+ERROR Object of class `object` has no attribute `callback` [missing-attribute]
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:383:5
+ERROR Object of class `object` has no attribute `callback` [missing-attribute]
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:444:5
+ERROR Object of class `TextIOBase` has no attribute `name` [missing-attribute]
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:457:17
+ERROR Class `object` has no class attribute `__table__` [missing-attribute]
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:541:48
+ERROR Class `object` has no class attribute `__table__` [missing-attribute]
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:620:48
+ERROR Class `object` has no class attribute `__table__` [missing-attribute]
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:723:48
+ERROR Class `object` has no class attribute `__table__` [missing-attribute]
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:801:48
+ERROR Class `object` has no class attribute `__table__` [missing-attribute]
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:856:42
+ERROR Argument `object` is not assignable to parameter `orig` with type `BaseException` in function `sqlalchemy.exc.DBAPIError.__init__` [bad-argument-type]
+    --> tests/unit_tests/commands/test_legacy_model_type_migration.py:1226:44
+ERROR Argument `SimpleNamespace` is not assignable to parameter `orig` with type `BaseException` in function `sqlalchemy.exc.DBAPIError.__init__` [bad-argument-type]
+    --> tests/unit_tests/commands/test_legacy_model_type_migration.py:1250:57
 ERROR Object of class `ModuleType` has no attribute `upgrade` [missing-attribute]
   --> tests/unit_tests/commands/test_upgrade_db.py:15:5
 ERROR Expected a callable, got `None` [not-callable]

@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 43.65% 43.77% +0.12%
Strict coverage 43.18% 43.30% +0.12%
Typed symbols 22,092 22,233 +141
Untyped symbols 28,829 28,872 +43
Modules 2557 2564 +7

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants